package com.purang.pms.im;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.annotation.Nullable;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.baidu.location.BDLocation;
import com.purang.pms.common.MapService;

@Route(path = "/com/main/activity")
public class ComMainActivity extends Activity {
    private static final String TAG = ComMainActivity.class.getSimpleName();
    private MapService mMapService;

    @Override
    protected void onStart() {
        super.onStart();
        mMapService = (MapService) ARouter.getInstance().build("/app/map/address").navigation();
        mMapService.startLocation(this);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_com);
    }

    public void getAddress(View view) {
        BDLocation bdLocation = mMapService.obtainBDLocation();
        Log.e(TAG, "bdLocation: " + bdLocation.toString());
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mMapService != null) {
            mMapService.onDestroy();
        }
    }
}
